package com.zishi.util;

/**
 * @author TP
 * @version 1.0
 * @date 2022/5/27/0027 19:43
 * 将传给模型的路径由网络地址改为本地地址
 */
public class TrainingPathChangeUtil {

    /**
     * 将传给模型的路径由网络地址改为本地地址
     * @param webPath
     * @return 返回本地路径
     */
    public static String changeWebPathToLocal(String webPath){
        if(webPath.contains(ConstUtil.WEBSITE_IMAGE_PATH)){
            webPath = webPath.replace(ConstUtil.WEBSITE_IMAGE_PATH, ConstUtil.IMAGE_PATH);
        }

        return webPath;
    }

    /**
     * 将传给模型的路径由本地地址改为网络地址
     * @param localPath
     * @return
     */
    public static String changeLocalPathToWeb(String localPath){
        if(localPath.contains(ConstUtil.IMAGE_PATH)){
            localPath = localPath.replace(ConstUtil.IMAGE_PATH, ConstUtil.WEBSITE_IMAGE_PATH);
        }

        return localPath;
    }
}
